/*
 * Copyright 2010 Aekold Helbrass
 * 
 * This file is part of RosterComposer.
 * 
 * RosterComposer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * RosterComposer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with RosterComposer.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.heresylabs.rostercomposer.units;

import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Aekold Helbrass <Helbrass@gmail.com>
 */
public class Category implements Comparable<Category>, java.io.Serializable {

    @XmlAttribute(name = "name")
    private String name;
    @XmlAttribute(name = "priority")
    private int priority = Integer.MAX_VALUE;
    @XmlElement(name = "unit", type = Unit.class)
    private List<Unit> units;

    @XmlTransient
    public String getName() {
        return name;
    }

    @XmlTransient
    public int getPriority() {
        return priority;
    }

    @XmlTransient
    public List<Unit> getUnits() {
        return units;
    }

    @Override
    public String toString() {
        return name;
    }

    @Override
    public int compareTo(Category o) {
        return priority - o.priority;
    }

    // <editor-fold defaultstate="collapsed" desc=" for serializer only ">
    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setPriority(int priority) {
        this.priority = priority;
    }

    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setUnits(List<Unit> units) {
        this.units = units;
    }
    // </editor-fold>

}
